The body of the program is a block of C. A block is a bunch of C statements enclosed in curly brackets.
At the moment our program body is empty, so the program does nothing. You can put as many statements as you like into a C program. Each statement does something.
Statements are separated from each other by the ; (semicolon) character. If you miss this out the compiler will become confused and complain at you.
Statements do the actual work which makes your program fly, this includes:
-
Creating variables to hold data
-
Manipulating variables
-
Changing the flow of execution in response to the data being worked on
On the right you can see a program with a number of "statements" in the main function body. As you run the program it moves from one on to the next. (Note that these statements are not actually technically correct C !)
/* Statements in main */
void main ( void )
{
statement1 ; /* not legal C! */
statement2 ; /* not legal C! */
statement3 ; /* not legal C! */
statement4 ; /* not legal C! */
}